<template>
	<view>
		<uni-forms ref="form" :model="userInfo" :rules="{}">
			<uni-forms-item label="" name="username">
				<uni-easyinput v-model="userInfo.username"  placeholder="请输入用户名" 
				@iconClick="iconClick"
				prefixIcon="person-filled" />
			</uni-forms-item>
			<uni-forms-item label="" name="password">
				<uni-easyinput  v-model="userInfo.password" placeholder="请输入密码" prefixIcon="locked" 
				type="password"/>
			</uni-forms-item>
			<uni-forms-item>
				<button type="primary" :plain="true" :loading="false" @click="login">登录</button>
			</uni-forms-item>
		</uni-forms>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo:{
					username:'',
					password:''
				}
			}
		},
		methods: {
			login(){
				if(this.userInfo.username==='tom'&& this.userInfo.password==='123'){
					uni.showToast({
						title:this.userInfo.username+'登录成功',
						duration:60000
					});
				}else{
					uni.showToast({
						title:'用户名或密码错误',
						icon:'none'
					});
				}
			},
			iconClick(e){
				console.log(e);
			}
		}
	}
</script>

<style>
page{
	}
</style>
